//
//  ExpandDynamicCell.h
//  mcrmSAAS
//
//  Created by wjxfhxy on 14-7-10.
//  Copyright (c) 2014年 GuangZhouXuanWu. All rights reserved.
//

#import <Foundation/Foundation.h>


#pragma mark --
#pragma mark -- expandDynamicCell

@class ExpandDynamicCell;

@protocol ExpandDynamicCellDelegate <NSObject>

@end

@interface ExpandDynamicCell : XUIGroupTableViewCell

@property(nonatomic,weak) id<ExpandDynamicCellDelegate> delegate;

+(CGFloat)caleHeight;

@end

#pragma mark --
#pragma mark -- headImageGroupTableViewCell

@interface HeadImageGroupTableViewCell : ExpandDynamicCell

@property(nonatomic,strong,readonly) UIImageView *headImageView;

@property(nonatomic,strong) NSString *title;

@end


#pragma mark --
#pragma mark -- textInputGroupTableViewCell

@class TextInputGroupTableViewCell;

@protocol TextInputGroupTableViewCellDelegate <ExpandDynamicCellDelegate>

@optional

- (void)textInputGroupTableViewCell:(TextInputGroupTableViewCell*)cell textFieldDidBeginEditing:(UITextField *)textField;

- (void)textInputGroupTableViewCell:(TextInputGroupTableViewCell*)cell textFieldDidEndEditing:(UITextField *)textField;

- (BOOL)textInputGroupTableViewCell:(TextInputGroupTableViewCell*)cell textFieldShouldReturn:(UITextField *)textField;

- (BOOL)textInputGroupTableViewCell:(TextInputGroupTableViewCell*)cell textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;

@end

#define TextInputCellTitleFont [UIFont systemFontOfSize:13]

#define TextInputCellTextFont  [UIFont systemFontOfSize:14]

/**
 *  偏移方式
 */
typedef NS_ENUM(NSUInteger, TextInputCellTitleOffsetType)
{
    TextInputCellTitleOffsetTypeDefault = 0, //必填＋6字符title
    TextInputCellTitleOffsetTypeSixChar,  //6字符title
    TextInputCellTitleOffsetTypeFourChar,  //4字符title
    TextInputCellTitleOffsetTypeMaskFourChar,  //必填＋4字符title
    TextInputCellTitleOffsetTypeTwoChar
};

@interface TextInputGroupTableViewCell : ExpandDynamicCell
{
    UILabel *_maskLabel;
    UILabel *_titleLabel;
    UITextField *_textField;
}

@property(nonatomic,strong) NSString *title;
@property(nonatomic,strong) NSString *text;
@property(nonatomic,assign) BOOL allowEmpty;
@property(nonatomic,strong) NSString *placeHolder;
@property(nonatomic,assign) NSUInteger textMaxLength;

@property(nonatomic,strong) UIColor *titleColor;
@property(nonatomic,strong) UIColor *textColor;

//新增／编辑界面下的静态风格
@property(nonatomic,assign) BOOL editStaticStyle;

-(void)setKeyBoarType:(NSInteger)keyBoarType;

-(void)setTextInputOffsetType:(TextInputCellTitleOffsetType)offsetType;

-(void)setTextInputOffsetType:(TextInputCellTitleOffsetType)offsetType offSetX:(CGFloat)x;

@end


#pragma mark --
#pragma mark -- similarTextInputGroupTableViewCell

@interface SimilarTextInputGroupTableViewCell : TextInputGroupTableViewCell

-(void)hiddenActivityIndicator:(BOOL)hidden;

@end

#pragma mark --
#pragma mark -- similarListGroupTableViewCell

@interface SimilarListGroupTableViewCell : ExpandDynamicCell

-(void)setSimilarTexts:(NSArray*)similarTexts;

@end


#pragma mark --
#pragma mark -- decimalGroupTableViewCell

@class DecimalGroupTableViewCell;

@protocol DecimalGroupTableViewCellDelegate <ExpandDynamicCellDelegate>

@optional

-(BOOL)decimalGroupTableViewCell:(DecimalGroupTableViewCell*)cell textFieldShouldEndEditing:(UITextField *)textField;

-(BOOL)decimalGroupTableViewCell:(DecimalGroupTableViewCell*)cell textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;

@end

@interface  DecimalGroupTableViewCell : TextInputGroupTableViewCell

@property(nonatomic,assign) NSUInteger pointScale;

@end


#pragma mark --
#pragma mark -- dropDownGroupTableViewCell

@class DropDownGroupTableViewCell;

@protocol DropDownGroupTableViewCellDelegate <ExpandDynamicCellDelegate>

-(void)clickedClearButtonOfDropDownGroupTableViewCell:(DropDownGroupTableViewCell*)cell;

@end

@interface DropDownGroupTableViewCell : TextInputGroupTableViewCell
{
    UIImageView *_arrowImageView;
    
    XUIButton *_clearBtn;
}

@property(nonatomic,assign) BOOL hiddenArrowImage; //showClearButton == YES，不起作用

@property(nonatomic,assign) BOOL showClearButton; //YES，隐藏arrowImage，NO，根据hiddenArrowImage来显示arrowImage

-(void)clickedUpInsideOfButton:(XUIButton *)btn;

@end

#pragma mark --
#pragma mark -- DropDownTextGroupTableViewCell
@interface DropDownTextGroupTableViewCell : DropDownGroupTableViewCell

@property(nonatomic,copy) NSString *selectText;

@end

#pragma mark --
#pragma mark -- dateTimeGroupTableViewCell

@interface DateGroupTableViewCell : DropDownGroupTableViewCell

@end


#pragma mark --
#pragma mark -- staticTextGroupTableViewCell

@interface StaticTextGroupTableViewCell : ExpandDynamicCell
{
    UILabel *_textLabel;
    UILabel *_titleLabel;
}

@property(nonatomic,strong) NSString *title;
@property(nonatomic,strong) NSString *text;

@property(nonatomic,assign) NSTextAlignment titleAlignment;

+ (CGFloat)textMaxContainWidth:(CGFloat)containWidth;

@end


#pragma mark --
#pragma mark -- activityIndicatorDropDownGroupTableViewCell

@interface ActivityIndicatorDropDownGroupTableViewCell : DropDownGroupTableViewCell

@property(nonatomic,assign) BOOL hiddenActivityIndicator;

@end


@interface ExpandDynamicCellFactory : NSObject

+(ExpandDynamicCell*)factory:(FieldDescript*)fixField;

+(CGFloat)caleHeght:(FieldDescript*)fixField;

+(CGFloat)caleStaticText:(DynamicFieldControlType)controlType heightWithText:(NSString*)text forContainWidth:(CGFloat)containWidth;

@end

@interface DicDropDownGroupTableViewCell : DropDownGroupTableViewCell

@property(nonatomic,strong) SingleSelectInfo *dicData;

@end

@interface DicDropDownStaticTextGroupTableViewCell : StaticTextGroupTableViewCell

@end
